/*
This file is part of Docking@Home.
http://docking.gcl.cis.udel.edu
Copyright (C) 2009 University of Delaware

Docking@Home is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Docking@Home is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Docking@Home.  If not, see <http://www.gnu.org/licenses/>.
*/
/*
	Filename: Button.h
	Description: An abstract class (aka interface) that contains all necessary
		functions that any type of button that must implement.
	Revision History: 
		Created - 01/08/08
		Added Scale Factors - 01/18/08
	Author: Robert Keller (01/08/08 -> current)
*/

#ifndef _Button_h
#define _Button_h

#include "../GLHelper.h"
#include "../ActionIDs.h"
#include "../GUI_Element_State.h"
#include "../Tabs/TabWindow.h"

#define BUTTON_MAX_NAME_LENGTH 25

class Button
{

public:

	// Destructor 

	virtual ~Button() {}

	// Member Modifiers

	void setName (const char n[BUTTON_MAX_NAME_LENGTH]);

	void setPosition (float newX, float newY);

	void setWidth (float w);
	void setHeight (float h);

	void select ();
	void unselect ();

	void setHoldSelection (bool hold);	
	
	void setSelectedColor(const float color[4]);
	void setUnselectedColor(const float color[4]);
	void setHoverColor(const float color[4]);

	void setActionID (int id);

	// Member Accessors

	int getActionID () const;

	bool isSelected () const;
	GUI_Element_State getState () const;

	// Functions that all Buttons need to implement

	virtual bool determineState (int x, int y, int clicked) = 0;

	virtual void resize (float scaleX, float scaleY) = 0;
	virtual void resizeSameBottom (float scaleX, float scaleY,
		int standardHeight, int windowHeight) = 0;
	virtual void resizeSameLeft (float scaleX, float scaleY,
		int standardWidth, int windowWidth) = 0;

	virtual void draw () = 0;
	virtual void drawSelected () = 0;
	virtual void drawUnselected () = 0;
	virtual void drawHovered () = 0;

protected:

	// Constructor 

	Button ();

	// Required Variables

	static GLHelper * glHelper;

	// Member Variables

	char name [BUTTON_MAX_NAME_LENGTH];
	
	// Coordinates when in 600 x 400 window
	float x;
	float y;

	// Coordinates based on scale factor and current
	// window size
	float currX;
	float currY;

	// Dimensions when in 600 x 400 window
	float width;
	float height;
	
	// Dimensions based on scale factor and current
	// window size
	float currWidth;
	float currHeight;

	// State Variables

	GUI_Element_State state;

	bool bSelected;
	bool bHoldSelection;

	// Action ID Number
	int actionID;

	// Status Color Variables
	float selectedColor[4];
	float unselectedColor[4];
	float hoverColor[4];

};

#endif
